import requests


def login_with_session():
    headers = {
        'User-Agent': 'Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.188 Safari/537.36'
    }
    data = {
        'userName': '19559917806',
        'userPwd': 'Gx583357384'
    }
    session = requests.session()
    session.post('https://sso.icve.com.cn/sso/@/style/login.scss', headers=headers, data=data)
    user_home_page = session.get("https://zjy2.icve.cn/teacher/homePage/homePage.html", headers=headers)
    with open('icve.html', 'w', encoding='utf-8') as f:
        f.write(user_home_page.content.decode())


if __name__ == '__main__':
    login_with_session()
